<include file="common/header"/>
	<div class="container">
		<input type="hidden" id="userid" value="{$user.id}">
		<div class="form-group" style="margin-top:10px">
		    <label class="col-sm-2 control-label" style="line-height:70px;">{$Think.lang.USER_PIC}</label>
		    <div class="upload col-sm-10">
              <div class="upload-img-box" >
              <empty name="user.head_pic">
                  <img width="70px" height="70px" src="{:C('HOME_IMAGE')}add_img.jpg"/>
              <else/>
              	  <img width="70px" height="70px" src="{$user.head_pic}"/>
              </empty>
              </div>
              <input type="file" id="pic" src="{$user.head_pic}" name="pic" title="{$Think.lang._UPDATE_IMG}">
           	</div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-2 control-label">{$Think.lang.USER_NAME}</label>
		    <div class="col-sm-10">
		      <input type="text" class="form-control" id="name" placeholder="{$Think.lang.USER_NAME}" value="{$user.name}">
		    </div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-2 control-label">{$Think.lang.USER_NICKNAME}</label>
		    <div class="col-sm-10">
		      <input type="text" class="form-control" id="nickname" placeholder="{$Think.lang.USER_NAME}" value="{$user.nickname}">
		    </div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-2 control-label">{$Think.lang.USER_PHONE}</label>
		    <div class="col-sm-10">
		      <input type="text" class="form-control" id="phone" placeholder="{$Think.lang.USER_NAME}" value="{$user.phone}">
		    </div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-2 control-label">{$Think.lang.USER_EMAIL}</label>
		    <div class="col-sm-10">
		      <input type="text" class="form-control" id="email" placeholder="{$Think.lang.USER_EMAIL}" value="{$user.email}">
		    </div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-2 control-label">{$Think.lang.USER_SEX}</label>
		    <div class="col-sm-10">
		      <input type="radio" name="sex" id="nan" value="1" <eq name="user.sex" value="1">checked</eq>><label for="nan">&nbsp;{$Think.lang.USER_MAN}</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="sex" id="nv" value="2" <eq name="user.sex" value="2">checked</eq>><label for="nv">&nbsp;{$Think.lang.USER_WOMAN}</label>
		    </div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-2 control-label">{$Think.lang._PASS}</label>
		    <div class="col-sm-10">
		      <input type="text" class="form-control" id="password" placeholder="{$Think.lang._PASS}" value="{$user.password}">
		    </div>
		  </div>

		  <div class="form-group">
		    <div class="col-sm-offset-2 col-sm-10">
		      <button style="background-color: #337ab7" class="btn btn-primary submit">{$Think.lang._SAVE}</button>
		    </div>
		  </div>
	</div>
	<script>
		var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
		var upload_url = "{:U('Ajax/upload_user_img')}";
		upload_a_img(upload_url);
		$('.submit').click(function(){
			var id=$('#userid').val();
			var pic = $('#pic').attr('src');
			var name = $('#name').val();
			var nickname=$('#nickname').val();
			var phone = $('#phone').val();
			var email = $('#email').val();
			var sex  = $("input[name='sex']:checked").val();
			var pass = $('#password').val();

			var data = {id:id,pic:pic,name:name,nickname:nickname,pass:pass,phone:phone,email:email,sex:sex};
			var url = "{:U('Yhgl/edit')}";
			$.post(url,data,function(res){
				if(res.code==1){
					layer.msg(res.msg,{time:2000},function(){
						parent.layer.close(index);
					})
				}else{
					layer.msg(res.msg,{time:2000},function(){
						parent.layer.close(index);
					})
				}
			})
		})
	</script>
<include file="common/footer"/>
